Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/honour force stop in restart #207

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rubu
Copy link

@rubu rubu commented Jul 11, 2024

Solves forever getting stuck on stopall and restartall as demonstrated by https://github.com/rubu/forever-stuck and described in foreversd/forever#904.

The base problem is that:

  1. assume there is a script that errors and exits quickly and is run with a spin time
  2. while the script is being restarted a stop command arrives to the worker, if at this point the process has exited (and thus the kill call on the current pid will fail) no exit event will be emitted but the next restart queued by the spin timer will reset force close, thus the client waiting on stop will hang

This PR basically handles a pending restart timer in the stop call and also honours a pending force restart in the restart flow - since the start is queued by nextTick there is a small chance that a stop could still arrive after restartChild has just completed (thus no timer) but the process has not yet been started and thus again using the existing pid would fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant